package com.touch.workshop.ui;
import java.awt.event.*;

import com.touch.workshop.Application;
import com.touch.workshop.ui.classeditor.ClassEditor;
import com.touch.workshop.ui.elementeditor.ElementEditor;
import com.touch.workshop.ui.expgrowth.CurveControls;
import com.touch.workshop.ui.library.*;
import com.touch.workshop.ui.npceditor.NPCEditor;
import com.touch.workshop.ui.scripteditor.ScriptEditorControls;
public final class MenuBarHandler implements ActionListener
{
	public void actionPerformed(ActionEvent ev)
	{
		final String source = ev.getActionCommand();
		if(source.equals("EXP Curve"))
			CurveControls.EXP_CURVE.setVisible(true);
		else if(source.equals("Level Limits"))
			Controls.LEVE_LIMIT.setVisible(true);
		else if(source.equals("Library"))
			LibraryControls.LIBRARY.setVisible(true);
		else if(source.equals("Class"))
		{
			ClassEditor editor = new ClassEditor();
			Application.vDesktop.add(editor);
			editor.setVisible(true);
		}
		else if(source.equals("Element"))
		{
			ElementEditor editor = new ElementEditor();
			Application.vDesktop.add(editor);
			editor.setVisible(true);
		}
		else if(source.equals("NPC"))
		{
			NPCEditor editor = new NPCEditor();
			Application.vDesktop.add(editor);
			editor.setVisible(true);
		}
		else if(source.equals("Script Editor"))
			ScriptEditorControls.SCRIPT_EDITOR.setVisible(true);
		else if(source.equals("Close"))
			System.exit(0);
		else if(source.equals("Client Library Viewer"))
			LibraryControls.Client_Library_Viewer.setVisible(true);
			//TODO: handle for client
		else if(source.equals("Server Library Viewer"))
			LibraryControls.Server_Library_Viewer.setVisible(true);
			//TODO: handle for server
		else
			System.out.println("//TODO: Implement action: " + source);
	}

}
